package service

import (
	"context"

	"github.com/jinzhu/copier"

	stage "stage/hertz_gen/stage"
	. "stageRpc/client"
	stageRpcModel "stageRpc/kitex_gen/stage"

	"github.com/cloudwego/hertz/pkg/app"
)

type EditDeskService struct {
	RequestContext *app.RequestContext
	Context        context.Context
}

func NewEditDeskService(Context context.Context, RequestContext *app.RequestContext) *EditDeskService {
	return &EditDeskService{RequestContext: RequestContext, Context: Context}
}

func (h *EditDeskService) Run(req *stage.Desk) (resp *bool, err error) {
	var desk = new(stageRpcModel.Desk)
	if err = copier.Copy(desk, req); err != nil {
		return nil, err
	}
	r, err := StageClient.EditDesk(context.Background(), desk)
	if err != nil {
		return nil, err
	}
	resp = &r
	return
}
